/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package com.googlecode.mindlistening.webui;

import java.util.Enumeration;
import java.util.logging.Logger;
import javax.servlet.ServletConfig;
import javax.servlet.ServletContext;

/**
 *
 * @author ryan
 */
public class ProxyServletConfig implements ServletConfig {

    private String proxyTo;
    private String prefix;
    private ProxyServletContext context;

    public ProxyServletConfig(String proxyTo, String prefix) {
        this.proxyTo = proxyTo;
        this.prefix = prefix;
        this.context = new ProxyServletContext();
    }


    @Override
    public String getServletName() {
        return "Proxy";
    }

    @Override
    public ServletContext getServletContext() {
        return context;
    }

    @Override
    public String getInitParameter(String string) {
        if ("ProxyTo".equals(string)) return proxyTo;
        if ("Prefix".equals(string)) return prefix;
        else {
            Logger.getLogger(ProxyServletConfig.class.getName()).warning("Requested init param not set: " + string);
            return null;
        }
    }

    @Override
    public Enumeration getInitParameterNames() {
        throw new UnsupportedOperationException("Not supported yet.");
    }

}
